<!--<%&#45;&#45;-->
<!--  Created by IntelliJ IDEA.-->
<!--  User: LWLONG-->
<!--  Date: 2021/2/25-->
<!--  Time: 19:27-->
<!--  To change this template use File | Settings | File Templates.-->
<!--&#45;&#45;%>-->

<html>
<head>
    <title>商品后台管理员登陆页面</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- 在web项目中 css的路径要替换为 css文件的uri
    也就是 /项目名/css/style.css
    -->
    <link rel="stylesheet" type="text/css"
          href="css/style.css" />
    <script src="js/vue-2.6.12.js"></script>
    <script src="js/axios-0.21.0.js"></script>
    <script src="js/qs-6.9.4.js"></script>
</head>

<body>
<div id="wrap">
    <div id="top_content">
        <div id="header">
            <div id="rightheader">

            </div>
            <div id="topheader">
                <h1 id="title">
                    <a href="#">商品管理</a>
                </h1>
            </div>
            <div id="navigation">
            </div>
        </div>

        <div id="content" >
            <p id="whereami">
            </p>
            <span style="color: #CE090E" >{{msg}}</span>
<!--<%&#45;&#45;            <c:set scope="session" var="msg" value=""></c:set>&#45;&#45;%>-->
            <h1>
                管理员登陆
            </h1>
            <form action="login" method="post">
                <table cellpadding="0" cellspacing="0" border="0"
                       class="form_table">
                    <tr>
                        <td valign="middle" align="right">
                            管理员账户:
                        </td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="username" v-model="user.username" />
                        </td>
<!--<%&#45;&#45;                        <c:remove var="username" scope="session"></c:remove>&#45;&#45;%>-->
                    </tr>
                    <tr>
                        <td valign="middle" align="right">
                            密码:
                        </td>
                        <td valign="middle" align="left">
                            <input type="password" class="inputgri" name="password" v-model="user.password" />
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">
                            验证码:
                        </td>
                        <td valign="middle" align="left">
                            <input type="text" class="inputgri" name="code" v-model="code" /> <img src="VerificationCode" onclick="this.src='VerificationCode?'+Math.random()">
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="right">
                            <a href="regist.jsp">管理员账户注册</a>
                        </td>
                        <td valign="middle" align="left">
                            <input type="button" class="button" @click="toLogin" value="登陆 &raquo;" />&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="reset" class="button" value="重置 &raquo;" />
                        </td>
                    </tr>
                </table>
                <p>

                </p>
            </form>
        </div>
    </div>
    <div id="footer">
        <div id="footer_bg">
            www.zparkhr.com.cn
        </div>
    </div>
</div>

<script>

    let content = new Vue({
        el:"#content",
        data:{
            user:{
                username:"",
                password:"",
            },
            code:"",
            msg:"test"
        },
        methods:{

            toLogin(){

                axios.post('login',"username="+this.user.username+"&password="+this.user.password+"&code="+this.code)
                    .then(function (response) {
                        // console.log(response);
                        this.msg=response.data;
                        console.log(response.data)
                        console.log("msg="+this.msg)
                        if (response.data=="success"){
                           location.href="product/queryList"
                        }else {

                        }

                    })
                    .catch(function (error) {

                        console.log(error);

                    });

            }


        }


    })
</script>

</body>
</html>
